package com.huawei;

import java.util.Locale;
import java.util.Scanner;

public class HJ002 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String firstLine = "";
        String secondLine = "";

        firstLine = scanner.nextLine().toLowerCase(Locale.ROOT);
        secondLine = scanner.nextLine().toLowerCase(Locale.ROOT);
        int count = 0;
        String[] firstArr = firstLine.split("");
        for (String s : firstArr) {
            if (s.equals(secondLine)){
                ++count;
            }
        }
        System.out.println(count);
    }
}
